/**
 * 详情对话框
 */
var ToolExpressScanInfoDlg = {
    data: {
        state: "",
        waveId: "",
        orderNumber: "",
        userId: "",
        userName: "",
        v1: "",
        v2: ""
    }
};

layui.use(['form', 'admin', 'ax','laydate'], function () {
    var $ = layui.jquery;
    var $ax = layui.ax;
    var form = layui.form;
    var admin = layui.admin;
    var laydate = layui.laydate;

    //让当前iframe弹层高度适应
    admin.iframeAuto();

    //执行一个laydate实例
    laydate.render({
      elem: '#modified_begin' //指定元素
			,type:'datetime'
        	,value:new Date()
    });

    //表单提交事件
    form.on('submit(btnSubmit)', function (data) {
    	var msg;
        $.ajax({
        	url:Feng.ctxPath + "/basicPutgoods/pullxlbStore",
			data:data.field,
        	cache: false,
        	dataType:"json",
        	beforeSend:function(){
        		msg = layer.msg('拉取中。。。请耐心等待', {
        			  icon: 16,
        			  shade: [0.2,'#000'], //0.1透明度的白色背景
        			  time: false
        		});
        	},
        	success:function(data){
            	layer.close(msg); 
        		if (data.success) {
	    			if (data.message != null &&data.message != "" ) {
	    				var msg2 =  layer.open({
	    					  title: '提示' ,
	    					  content: data.message,
	    					  btn: ['确定'],
	    					  yes: function (){
									parent.submit = 1
	    						  layer.close(msg2);
	    		                  var Indexs = parent.layer.getFrameIndex(window.name);
	    		                  parent.layer.close(Indexs);
	    					  }
	    				});     
					} else {
						parent.submit = 1
	            		Feng.success("拉取成功!");
	                	var Indexs = parent.layer.getFrameIndex(window.name);
	                    parent.layer.close(Indexs);
					}
				} else {
                    Feng.error("操作失败！"+data.message);
				}
        	},
        	error:function(data){
            	layer.close(msg); 
                Feng.error("操作失败！" + data.responseJSON.message)
        	}
        })

        return false;
    });

    //返回按钮
    $("#backupPage").click(function () {
    	var Index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(Index);
    });

});